import { get, post } from '@/utils/request'
import type { LoginParams, LoginResult, UserInfo } from '@/types/user'

// 登录
export const login = (data: LoginParams) => {
  return post<LoginResult>('/api/auth/login', data)
}

// 获取用户信息
export const getUserInfo = () => {
  return get<UserInfo>('/api/auth/info')
}

// 退出登录
export const logout = () => {
  return post('/api/auth/logout')
}

// 刷新token
export const refreshToken = () => {
  return post<{ token: string }>('/api/auth/refresh')
} 